package aex.service;



import java.io.Serializable;
import java.util.LinkedHashMap;
import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import aex.dao.DateDictionaryDao;
import aex.domain.DateDictionary;



@Transactional(readOnly = false)
@Service(DateDictionaryService.SERVICE_NAME)

public class DateDictionaryService  {

	
	public static final String SERVICE_NAME="aex.service.DateDictionaryService";
	/**
	 * 以注解的形式让spring为我们注入dao的实现类
	 */
	@Resource(name = DateDictionaryDao.SERVICE_NAME)
	public DateDictionaryDao dao;
	
	public DateDictionaryService() {
		
	}
	
	/**
	 * 通过关键字查询出所有的数据字典项
	 * @param keyWord
	 * @return
	 */
	public List<DateDictionary> getByKeyWord(String keyWord){
		LinkedHashMap<String, String> orderby=new LinkedHashMap<String, String>();
		orderby.put("tName.ddCode", "asc");
		return dao.findCollectionByConditionNoPage("and tName.ddKeyWord='"+keyWord+"'", null, orderby);
	}

	public DateDictionary findByID(Serializable id) {
		return dao.findObjectByID(Integer.parseInt(id+""));
	}
	public void deleteById(Serializable id) {
		dao.deleteObjectByIDs(Integer.parseInt(id+""));
	}
	public void save(DateDictionary obj) {
		dao.save(obj);
	}
	public void update(DateDictionary obj) {
		dao.merge(obj);
	}
}
